<?php
class TagController extends Controller {
    
    public function indexAction(){
        $model_tag = new TagModel();
        $this->tags = $model_tag->getTags();
        return 'tag/index';    
    }

    public function addAction () {
        if (! $_POST) {
            
            return 'tag/add';
        } else {
            $value['name'] = $_POST['name'];
            $value['weight'] = $_POST['weight'];
            
            $model_tag = new TagModel();
            if ($model_tag->insert($value)) {
                $this->redirect('notify/success');
            } else {
                $this->redirect('notify/error');
            }
        }
    }
}
?>